<?php
class Control_ServerList_edit {
 	function edit() {
 		$id = MooForm::request('id');	
 		$serverListDao = MooDao::get('Serverlist');
 		$serverListObj = $serverListDao->load($id);
 		
 		if(empty($serverListObj)) {
 			exit("id not exist");
 		}
 		
 		$game 	  = $serverListObj->s_game;
 		$platfrom = $serverListObj->s_platform;
 		$filename = $serverListObj->s_filename;
 		
 		// 英文转中文
 		$nowGame = MooObj::get('Game')->transportGameToZh($game);
 		
 		// 设置加载platform信息
 		MooObj::get('Control_Data')->setPlatformData($game);
 		
 		$data = $serverListObj->s_serverlist;
 		
		$dataArr = MooJson::decode($data);	
		$version		 	= $dataArr['version'];		
		$defaultSeverID 	= $dataArr['defaultSeverID'];		
		$severs 			= $dataArr['severs'];		
		
		// 主键id参数重要
		MooView::set('s_id', $id);
		
		MooView::set('nowGame', $nowGame);
		MooView::set('platform', $platfrom);
		MooView::set('version', $version);
		MooView::set('defaultSeverID', $defaultSeverID);
		MooView::set('severs', $severs);
			
		MooView::render("serverListEdit");
	}
}
